/**
 * Copyright 2016-2017 TVI Go Easy.
 * Created on 2017/4/18 13:55
 */
package org.mechanic.fund.domain;

import com.fasterxml.jackson.annotation.JsonIgnore;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.cache.annotation.EnableCaching;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 实体父类。所有实体必须继承该类。
 *
 * @author mechanic
 * @version 0.0.1
 */
@MappedSuperclass
@EnableCaching
public abstract class BaseEntity implements Serializable {

    private static final long serialVersionUID = -5911827768674289194L;

    // JPA 主键标识, 策略为系统生成UUID
    @Id
    @GenericGenerator(name = "system-uuid", strategy = "uuid")
    @GeneratedValue(generator = "system-uuid")
    @Column(name = "id")
    protected String id;
    /**
     * 创建人
     */
    @JsonIgnore
    @Column(name = "create_user", updatable = false)
    protected String createUser;
    /**
     * 创建时间
     */
    @JsonIgnore
    @Column(name = "create_time", columnDefinition = "TIMESTAMP", updatable = false)
    protected LocalDateTime createTime;
    /**
     * `
     * 最后更新人
     */
    @Column(name = "update_user")
    @JsonIgnore
    protected String updateUser;
    /**
     * 最后更新时间
     */
    @JsonIgnore
    @Column(name = "update_time", columnDefinition = "TIMESTAMP")
    protected LocalDateTime updateTime;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getCreateUser() {
        return createUser;
    }

    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public String getUpdateUser() {
        return updateUser;
    }

    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }

    public LocalDateTime getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(LocalDateTime updateTime) {
        this.updateTime = updateTime;
    }
}
